package belka.us.ohostoggleswitch;

import belka.us.ohostoggleswitch.util.ToggleSwitchButton;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.agp.components.Attr;
import ohos.agp.components.AttrSet;
import ohos.app.Context;
import org.junit.Test;

import java.util.Optional;

import static org.junit.Assert.*;

public class ExampleOhosTest {

    Context context = MyApplication.getContexts();

    @Test
    public void testBundleName() {
        final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
        assertEquals("belka.us.ohostoggleswitch", actualBundleName);
    }

    @Test
    public void testBaseToggleSwitchButtonInstance(){
        ToggleSwitchButton button = new ToggleSwitchButton(context);
        assertNotNull(button);
    }

    @Test
    public void testBaseToggleSwitchInstance(){
        BaseToggleSwitch baseToggleSwitch = new BaseToggleSwitch(context, new AttrSet() {
            @Override
            public Optional<String> getStyle() {
                return Optional.empty();
            }

            @Override
            public int getLength() {
                return 0;
            }

            @Override
            public Optional<Attr> getAttr(int i) {
                return Optional.empty();
            }

            @Override
            public Optional<Attr> getAttr(String s) {
                return Optional.empty();
            }
        }) {
            @Override
            protected boolean isActive(int position) {
                return false;
            }

            @Override
            protected void onClickOnToggleSwitch(int position) {

            }
        };
        assertNotNull(baseToggleSwitch);
    }

    @Test
    public void testToggleSwitchInstance(){
        ToggleSwitch toggleSwitch = new ToggleSwitch(context);
        assertNotNull(toggleSwitch);
    }

    @Test
    public void testMulttipleToggleSwitchButton(){
        MultipleToggleSwitch multipleToggleSwitch = new MultipleToggleSwitch(context, new AttrSet() {
            @Override
            public Optional<String> getStyle() {
                return Optional.empty();
            }

            @Override
            public int getLength() {
                return 0;
            }

            @Override
            public Optional<Attr> getAttr(int i) {
                return Optional.empty();
            }

            @Override
            public Optional<Attr> getAttr(String s) {
                return Optional.empty();
            }
        });
        assertNotNull(multipleToggleSwitch);
    }
}